#include <iostream>
#include <cmath>

using namespace std;

//类定义部分
//定义有理数类（分母不为0的分数，分子分母均为整数）
class Rational
{
//私有成员
public:
    int iUp;    //分子
    int iDown;  //分母
    void Reduce();  //有理数的约简
    int Gcd(int l, int r);  //求两个整数的最大公约数,在约简时需要求取分子与分母的最大公约数
//公有成员
public:
    //构造函数,函数体内调用Reduce对有理数进行约简
    Rational(int num1 = 0,int num2 = 1);
    //负号-重载为公有成员函数
    Rational operator - ();
    //赋值运算符=重载为公有成员函数
    Rational & operator = (const Rational &robj);
    //前置++
    Rational & operator ++ ();
    //前置--
    Rational & operator -- ();
    //后置++
    Rational operator ++ (int );
    //后置--
    Rational operator -- (int );
//友元函数类内声明
    //实现有理数的加减乘除
    friend Rational operator + (Rational obj1,Rational obj2);
    friend Rational operator - (Rational obj1,Rational obj2);
    friend Rational operator * (Rational obj1,Rational obj2);
    friend Rational operator / (Rational obj1,Rational obj2);

    //实现有理数的大小关系比较
    friend bool operator < (Rational obj1,Rational obj2);
    friend bool operator <= (Rational obj1,Rational obj2);
    friend bool operator > (Rational obj1,Rational obj2);
    friend bool operator >= (Rational obj1,Rational obj2);

    //重载流插入符>>和流提取符<<，分别用于有理数的输出和输入
    //输出格式为“分子/分母”，若为整数，则直接输出整数
    friend ostream & operator << (ostream & out, const Rational &robj);
    friend istream & operator >> (istream & in, Rational &robj);
};

//类实现部分
//求两个整数的最大公约数
int Rational::Gcd(int l, int r)
{
    //辗转相除法
    int m=l%r;
    while(m!=0)
    {
        l=r;
        r=m;
        m=l%r;
    }
    return r;
}
//有理数的约简
void Rational::Reduce()
{
    int gcd = abs(Gcd(iUp, iDown)); //避免出现最大公约数是负数的情况
    iUp /= gcd;
    iDown /= gcd;   //约分
    if(iDown < 0)
    {
        iUp = -iUp;
        iDown = -iDown;
    }
}
//构造函数
Rational :: Rational (int num1,int num2) : iUp(num1),iDown(num2)
{
    Reduce(); //函数体内调用Reduce对有理数进行约简
}
//负号-重载为公有成员函数
Rational Rational :: operator - ()
{
    Rational temp;
    temp.iUp = -iUp;
    temp.iDown = iDown;
    return temp;
}
//赋值运算符=重载为公有成员函数
Rational & Rational :: operator = (const Rational &robj)
{
    iUp = robj.iUp;
    iDown = robj.iDown;
    Reduce();
    return *this;
}
//前置++
Rational & Rational :: operator ++ ()
{
    iUp += iDown;
    return *this;
}
//前置--
Rational & Rational :: operator -- ()
{
    iUp -= iDown;
    return *this;
}
//后置++
Rational Rational :: operator ++ (int )
{
    Rational temp;
    temp.iUp = iUp;
    temp.iDown = iDown;
    iUp += iDown;
    return temp;
}

//后置--
Rational Rational :: operator -- (int )
{
    Rational temp;
    temp.iUp = iUp;
    temp.iDown = iDown;
    iUp -= iDown;
    return temp;
}

//友元函数实现部分
//加
Rational operator + (Rational obj1,Rational obj2)
{
    Rational sum;
    sum.iUp = obj1.iUp * obj2.iDown + obj2.iUp * obj1.iDown;
    sum.iDown = obj1.iDown * obj2.iDown;
    return sum;
}
//减
Rational operator - (Rational obj1,Rational obj2)
{
    Rational sub;
    sub.iUp = obj1.iUp * obj2.iDown - obj2.iUp * obj1.iDown;
    sub.iDown = obj1.iDown * obj2.iDown;
    return sub;
}
//乘
Rational operator * (Rational obj1,Rational obj2)
{
    Rational pro;
    pro.iUp = obj1.iUp * obj2.iUp;
    pro.iDown = obj1.iDown * obj2.iDown;
    return pro;
}
//除
Rational operator / (Rational obj1,Rational obj2)
{
    Rational quot;
    quot.iUp = obj1.iUp * obj2.iDown;
    quot.iDown = obj1.iDown * obj2.iUp;
    return quot;
}
//严格小于
bool operator < (Rational obj1,Rational obj2)
{
    return ((obj1.iUp/(double)obj1.iDown)<(obj2.iUp/(double)obj2.iDown));
}
//非严格小于
bool operator <= (Rational obj1,Rational obj2)
{
    return ((obj1.iUp/(double)obj1.iDown) <= (obj2.iUp/(double)obj2.iDown));
}
//严格大于
bool operator > (Rational obj1,Rational obj2)
{
    return ((obj1.iUp/(double)obj1.iDown) > (obj2.iUp/(double)obj2.iDown));
}

//非严格大于
bool operator >= (Rational obj1,Rational obj2)
{
    return ((obj1.iUp/(double)obj1.iDown) >= (obj2.iUp/(double)obj2.iDown));
}

//重载流插入>>和流提取<<
ostream & operator << (ostream & out, const Rational &robj)
{
    if (robj.iUp % robj.iDown != 0)
    {
        out << robj.iUp << "/" << robj.iDown <<endl;
    }
    else
    {
        out << robj.iUp/robj.iDown << endl;
    }
    return out;
}
istream & operator >> (istream & in, Rational &robj)
{
    in >> robj.iUp >> robj.iDown;
    return in;
}

int main()
{
    //输入两组分子分母
    int iUp1,iDown1;
    int iUp2,iDown2;
    cin >> iUp1 >> iDown1;
    cin >> iUp2 >> iDown2;
    //根据输入的分子和分母定义两个有理数对象a和b
    Rational a(iUp1,iDown1), b(iUp2,iDown2);
    Rational test1,test2,test3,test4,test5,test6,test7,test8,test9;
    test1 = a + b;
    test2 = a - b;
    test3 = a * b;
    test4 = a / b;
    test5 = -a;
    test6 = ++a;
    test7 = --a;
    test8 = a++;
    test9 = a--;
    cout << "a+b: " << test1;
    cout << "a-b: " << test2;
    cout << "a*b: " << test3;
    cout << "a/b: " << test4;
    cout << "-a: " << test5;
    cout << "++a: " << test6;
    cout << "--a: " << test7;
    cout << "a++: " << test8;
    cout << "a--: " << test9;

    cout << "a<b: ";
    if(a < b)
    {
        cout << "true" << endl;
    }
    else
        cout << "false" << endl;

    cout << "a<=b: ";
    if(a <= b)
    {
        cout << "true" << endl;
    }
    else
        cout << "false" << endl;

    cout << "a>b: ";
    if(a > b)
    {
        cout << "true" << endl;
    }
    else
        cout << "false" << endl;

    cout << "a>=b: ";
    if(a >= b)
    {
        cout << "true" << endl;
    }
    else
        cout << "false" << endl;

    return 0;
}
